Script:3880
Fountain syntax Use completion for character names Vim's built-in completion is very handy for repeating character names and other repetitive words. Type RATATOUILLE once in the script; from then on, you can type RA. Get in order to use RA instead, even easier! Indenting Fountain with regex Fountain allows (but doesn't require) screenplay-like indentation. Although that makes Fountain a perfect candidate for a Vim indentation file, I have no idea how to write one! Until there is a proper indentation file, you might want to use a weaker alternative. The following uses regex, and you may need to tweak it for your circumstances, since it is a very incomplete solution. This indents character, parentheticals, and transitions; dialogue remains flush left (breaks would have to be inserted in order to properly align blocks of indented text, and that's a job for a more advanced script). command FountainIndent 13,$s/^\s*//ge | 13,$s/^\([ 0-9A-Z()\.\#\^]*\)$/\t\t\1/ge | 13,$s/^(\(.*\))$/\t(\1)/ge | 13,$s/\(.*\) TO:$/\t\t\t\t\t\t\t\t\t\t\t\t\1 TO:/ge | 13,$s/^> \(.*\)$/\t\t\t\t\t\t\t\t\t\t\t\t> \1/ge | 13,$s/^\s*>\(.*\)\1fi :FountainIndent If you're really brave, you can make this automatic with something like this in your VIMRC. Use with caution, this will automatically indent your screenplay file upon saving: au BufWrite *.fountain FountainIndent Here is how to tweak: the first regex clears all leading spaces and tabs in order to clear the deck. Note that every regex is set to '13,$'; the idea is to protect your title page info; bump that number accordingly if you use more or less lines for your title pages. Since headers aren't indented, you have some margin for error. CAUTION: let's be clear, this regex clears all previous indents below the title page. If you have a manually indented section, you'll lose it. Possible solution: change the first regex from '\s' to '\t', and use spaces to manually indent. I *think* that will work. The second regex tabs character names twice; edit the section that begins '0-9A-Z' if you need special characters. For example, if you have a character named BJÖRN, you'll want something like '0-9A-ZÖ'. (The syntax file's already got you covered in this case.) The third regex tabs parentheticals once. I don't think there's any reason to change this bit, it simply indents any line that begins and ends with parentheses. Add more tabs (\t) to either if you want a more dramatic look. The fourth and fifth regex push the transition line (a line that ends with 'TO:' or begins with '>') to the right side of the page. Remove or add tabs as desired. The sixth regex has been added to address centered text ('> centered <'), which otherwise becomes confused with forced transitions. Again, adjust the number of tabs as desired. The best we can do is suggest a centered position. The seventh regex provides for forced scene headers (lines that begin with a period), and as a corrective for scene headers that get mistaken for character names. The regex here assumes your scene header begins with EXT. or INT., and you'll want to change that if you use one of the allowed variations. The last regex is a final cleanup, to remove any orphaned tabs. (In addition, at the very end I turn off search highlighting, because the last search tends to leave an annoying highlight residue. This is entirely optional) This solution doesn't come close to covering all of Fountain's syntax, but should serve most normal use. Keep in mind that this indentation has no effect on final output: Fountain indentation is entirely a matter of personal aesthetics, and is ignored by Fountain processing tools like Screenplain. Comments